#pragma once

#include <QMessageLogContext>
#include <QString>
#include <QFile>
#include <QTextStream>
#include <QDateTime>
#include <QMutex>
#include <QMap>
#include <QJsonArray>
#include <QMessageBox>
#include "VTranslate.h"

namespace VFunctions
{
    enum IconType
    {
        WARNING,
        INFO,
        ERROR,
        SUCCESS
    };


    QString get_ini_value(const QString full_path,const QString group, const QString item, QString default_value="");
	bool set_ini_value(const QString full_path, const QString group, const QString item, const QString value);
	bool creat_dir(const QString dir_path, const QString folder_name);
	bool creat_file(const QString full_path);
	bool matching_string(const QString source, const QString input);
	void clearFiles(const QString &folderFullPath);
    QString read_file_text(QString path);
    QString read_gbk_file_text(QString path);
    uint file_last_modify_time(QString path);
    bool save_file(QString path, QString text);
    bool file_append_text(QString path, QString text);
    bool save_file_to_gbk(QString path, QString text);
    QString get_c_keyword_zn_to_en(QString word);
    bool is_chinese(QString word);
    void init_path();
    void load_setting();


    QString GBK2UTF8(const QString &inStr);
    QString UTF82GBK(const QString &inStr);
    std::string gbk2utf8(const QString &inStr);
    QString utf82gbk(const std::string &inStr);

    void outputMessage(QtMsgType type, const QMessageLogContext &context, const QString &msg);
    QString get_current_qss();

    void init_keyword_map();

    QString ctags(QString text);
    QString indent(QStringList parameter, QString text);
    bool pack(QString source, QString save_path);

    bool file_translate(QString source_path, QString save_dir, QString text, VTranslate &translate);

    QStringList get_file_path_list(QString path);
    QStringList get_folder_list(QString path);
    QStringList get_project_all_file_path(QString esln_path);
    QStringList get_project_all_file_name(QString esln_path);
    QStringList get_skins_names();

    QJsonDocument get_file_jsonDocument(QString path);
    QString get_today();
    QString string_reverse(QString text);
    QString string_regexp(QString text, QString regexp, int nth = 0);
    int string_count(QString text, QChar c);
    int RGB2BGR(int color);
}


